﻿using System;
using System.Collections.Generic;
using System.Windows.Media;
using System.Windows;
using System.IO.Packaging;
using System.IO;
using System.Windows.Controls;


namespace WickedFlame.Util.Data
{
    public class XpsFileFormat
    {
        public void Export(Uri path, Canvas surface)
        {
            if (path == null) return;

            //// Save current canvas transorm
            //Transform transform = surface.LayoutTransform;
            //// Temporarily reset the layout transform before saving
            //surface.LayoutTransform = null;

            //// Get the size of the canvas
            //Size size = new Size(surface.Width, surface.Height);
            //// Measure and arrange elements
            //surface.Measure(size);
            //surface.Arrange(new Rect(size));

            //// Open new package
            //Package package = Package.Open(path.LocalPath, FileMode.Create);
            //// Create new xps document based on the package opened
            //XpsDocument doc = new XpsDocument(package);
            //// Create an instance of XpsDocumentWriter for the document
            //XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc);
            //// Write the canvas (as Visual) to the document
            //writer.Write(surface);
            //// Close document
            //doc.Close();
            //// Close package
            //package.Close();

            //// Restore previously saved layout
            //surface.LayoutTransform = transform;
        }
    }
}
